package io.renren.modules.live.service.impl;

import io.renren.modules.live.vo.AnchorUpdateVideoVo;
import io.renren.modules.live.vo.FindByVoideListVideoNameAndAnchorNameVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.live.dao.FanweVideoDao;
import io.renren.modules.live.entity.FanweVideoEntity;
import io.renren.modules.live.service.FanweVideoService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


@Service("fanweVideoService")
public class FanweVideoServiceImpl extends ServiceImpl<FanweVideoDao, FanweVideoEntity> implements FanweVideoService {

    @Resource
    private FanweVideoDao fanweVideoDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<FanweVideoEntity> page = this.page(
                new Query<FanweVideoEntity>().getPage(params),
                new QueryWrapper<FanweVideoEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public List<FanweVideoEntity> getVoideList() {
        return fanweVideoDao.getVoideList();
    }

    @Override
    public void anchorUpdateVideo(AnchorUpdateVideoVo updateVideoVo) {
        fanweVideoDao.anchorUpdateVideo(updateVideoVo);
    }

    @Override
    public List<FanweVideoEntity> getBysortedFansAnchorIdListId(Long page,Long size) {
        return fanweVideoDao.getBysortedFansAnchorIdListId(page,size);
    }

    @Override
    public List<FanweVideoEntity> getChargesVoideList() {
        return fanweVideoDao.getChargesVoideList();
    }

    @Override
    public List<FanweVideoEntity> findByVoideListVideoNameAndAnchorName(String content) {
        List<FanweVideoEntity> byVoideListVideoNameAndAnchorName = fanweVideoDao.findByVoideListVideoNameAndAnchorName(content);
        return byVoideListVideoNameAndAnchorName;

    }

    @Override
    public List<FanweVideoEntity> findByAnchorIdList(List<Long> anchorIdList) {
        return fanweVideoDao.findByAnchorIdList(anchorIdList);
    }

    @Override
    public List<FanweVideoEntity> getVoideRecommendList() {
        return fanweVideoDao.getVoideRecommendList();
    }

    @Override
    public List<FanweVideoEntity> getUserAttentionAnchor(Long anchorId) {
        return fanweVideoDao.getUserAttentionAnchor(anchorId);
    }

    @Override
    public void addAnchorVideoFile(Long anchorId, String fileUrl) {
        fanweVideoDao.addAnchorVideoFile(anchorId, fileUrl);
    }

    @Override
    public FanweVideoEntity getByAnchorId(Long anchorId) {
        return fanweVideoDao.getByAnchorId(anchorId);
    }

}